<template>
  <div class="container">
    <NavHead>
      <template v-slot:iconfont-left>
        <i class="iconfont icon-arrowLeft arrow" @click="$router.back()"></i>
      </template>
      <template v-slot:iconfont-right>
        <i class="iconfont icon-ellipsis2 point"></i>
      </template>
    </NavHead>
    <ShopSwiper />
    <div class="container1" >
      <div>
        <div class="title">
          <p>{{ list.name }}</p>
          <p class="price">¥ {{ list.price }}</p>
        </div>
        <div class="paint">
          <i class="iconfont icon-iconfontzhizuobiaozhun20"></i>
          <p>分享</p>
        </div>
      </div>
      <div class="desc">
        <p>
          {{ list.desc1 }}
        </p>
        <p>
          {{ list.desc2 }}
        </p>
      </div>
      <div class="bott">
        <div class="icons">
          <i class="iconfont icon-fuwuerji"></i>
          <i class="iconfont icon-gouwuche1" @click="jumpCar1"></i>
          <i class="iconfont icon-aixin"></i>
        </div>
        <div class="car" @click="jumpCar"> 
          <p>加入购物车</p>
        </div>
        <div class="buy">
          <p>立即购买</p>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import api from "../../api";
import NavHead from "../../components/NavHead";
import ShopSwiper from "../shop/shopSwiper/ShopSwiper";
export default {
  name: "Details",
  data() {
    return {
      list:[],
    };
  },
  props: {
    id: {
      data: Number,
      default: "",
    },
  },
  components: {
    NavHead,
    ShopSwiper,
  },
  mounted() {
    console.log(this.id);
    api
      .getDetails({
        id: this.id,
      })
      .then((res) => {
        console.log(res.data);
        this.list = res.data.list;
      });
  },
  methods:{
    jumpCar(){
      this.$router.push({name:"ShopCar"})
    },
    jumpCar1(){
      this.$router.push({name:'ShopCar'})
    }
  }
};
</script>

<style lang="less" scoped>
.container {
  .arrow {
    color: #fff;
    margin-top: 0.3rem;
  }
  .point {
    color: #fff;
    font-size: 0.58rem;
  }
  .title {
    width: 60%;
    margin-top: 0.5rem;
    margin-left: 0.2rem;
    font-size: 0.4rem;
    text-align: left;
    color: rgb(65, 62, 62);
    .price {
      margin-top: 0.1rem;
      color: red;
    }
  }
  .paint {
    margin-top: -1rem;
    margin-left: 6rem;
    i {
      font-size: 0.6rem;
    }
    p {
      font-size: 0.24rem;
    }
  }
  .desc {
    margin-top: 0.2rem;
    width: 100%;
    p {
      font-size: 0.32rem;
      line-height: 0.4rem;
      color: rgb(65, 62, 62);
      text-align: left;
      padding-left: 0.2rem;
      table-layout: fixed;
      word-wrap: break-all;
      word-break: normal;
    }
  }
  .bott {
    position: fixed;
    bottom: 0;
    width: 100%;
    border-top: 1px solid red;
    height: 1rem;
    display: flex;
    .icons {
      flex: 1;
      height: 100%;
      margin: 0.2rem;
      i {
        font-size: 0.5rem;
        padding-left: 0.2rem;
        color: #ff5555;
        font-weight: bold;
      }
    }
    .car {
      flex: 1;
      height: 100%;
      background-color: orange;
      text-align: center;
      p {
        margin-top: 0.2rem;
        color: #fff;
      }
    }
    .buy {
      flex: 1;
      height: 100%;
      background-color: #ff5555;
      p {
        margin-top: 0.2rem;
        color: #fff;
      }
    }
  }
}
</style>>
